package managedBean.contactUs;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

import org.primefaces.model.map.DefaultMapModel;
import org.primefaces.model.map.LatLng;
import org.primefaces.model.map.MapModel;
import org.primefaces.model.map.Marker;

import controller.admin.ProfileController;
import controller.contactUs.ContactUsController;
import dto.contactUs.TenantDTO;

@ManagedBean(name = "contactUsManagedBean")
@ViewScoped
public class ContactUsManagedBean implements Serializable {

	private static final long serialVersionUID = 8183505060013350031L;
	@ManagedProperty(value = "#{contactUsController}")
	private ContactUsController contactUsController;
	private MapModel simpleModel;
	private String center="17.494974,78.334493";
	@PostConstruct
	public void init() {
		simpleModel = new DefaultMapModel();
		TenantDTO dto = new TenantDTO();
		dto.setName("8P2");
		try {
			dto=contactUsController.getDetails(dto);
			// Shared coordinates
			LatLng coord1 = new LatLng(dto.getLatitude(), dto.getLongitude());
			center=dto.getLatitude()+","+dto.getLongitude();
			// Basic marker
			simpleModel.addOverlay(new Marker(coord1, dto.getAddress()));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	public MapModel getSimpleModel() {
		return simpleModel;
	}

	/**
	 * @return the contactUsController
	 */
	public ContactUsController getContactUsController() {
		return contactUsController;
	}

	/**
	 * @param contactUsController
	 *            the contactUsController to set
	 */
	public void setContactUsController(ContactUsController contactUsController) {
		this.contactUsController = contactUsController;
	}

	/**
	 * @return the serialversionuid
	 */
	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	/**
	 * @param simpleModel
	 *            the simpleModel to set
	 */
	public void setSimpleModel(MapModel simpleModel) {
		this.simpleModel = simpleModel;
	}

	/**
	 * @return the center
	 */
	public String getCenter() {
		return center;
	}

	/**
	 * @param center the center to set
	 */
	public void setCenter(String center) {
		this.center = center;
	}

}
